package sql.mysql;


import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.junit.Test;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created by :Infaraway
 * DATE : 2017/3/6
 * Time : 15:10
 * Funtion : 测试C3P0连接池技术
 */
public class c3p0Test {

    private static DataSource dataSource = null;
    static {
        dataSource = new ComboPooledDataSource("testc3p0");
    }

    public static Connection getConnection() throws SQLException {
        return dataSource.getConnection();
    }
    @Test
    public void testC3P0() throws SQLException {
        Connection connection = getConnection();
        System.out.println(connection);
    }

}
